package com.example.homework;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class Hi extends AppCompatActivity  implements View.OnClickListener {
    EditText editText;
    TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hi);
        editText = findViewById(R.id.input);
        textView = findViewById(R.id.output);
    }


    @Override
    public void onClick(View view) {
        String input = editText.getText().toString();

        if (input.equals("")) {
            Toast.makeText(this, "please......", Toast.LENGTH_SHORT).show();
        } else {
            if (view.getId() == R.id.btn3) {
                float money = Float.valueOf(input);
                textView.setText(String.format("%.2f", money / 6.466));
            }
            if (view.getId() == R.id.btn2) {
                float money = Float.valueOf(input);
                textView.setText(String.format("%.2f", money / 7.5743));
            }
            if (view.getId() == R.id.btn1) {
                float money = Float.valueOf(input);
                textView.setText(String.format("%.2f", money * 182.4343));
            }

        }
    }
}